import * as ProsemirrorTables from '@skiff-org/prosemirror-tables';

import BlockquoteInsertNewLineCommand from './BlockquoteInsertNewLineCommand';
import CodeBlockCommand from './CodeBlockCommand';
import AddCommentCommand from './comments/AddCommentCommand';
import createCommand from './createCommand';
import EmDash from './emDash';
import EnDash from './enDash';
import HeadingCommand from './HeadingCommand';
import HorizontalRuleCommand from './HorizontalRuleCommand';
import ImageInsertCommand from './ImageInsertCommand';
import IndentCommand from './IndentCommand';
import LinkSetURLCommand from './LinkSetURLCommand';
import ListItemInsertNewLineCommand from './ListItemInsertNewLineCommand';
import ListItemMergeCommand from './ListItemMergeCommand';
import ListSplitCommand from './ListSplitCommand';
import ListToggleCommand from './ListToggleCommand';
import * as MarkNames from './MarkNames';
import MarksClearCommand from './MarksClearCommand';
import MarkToggleCommand from './MarkToggleCommand';
import MathInsertCommand from './MathInsertCommand';
import { BULLET_LIST, ORDERED_LIST, TODO_LIST, TOGGLE_LIST } from './NodeNames';
import PrintCommand from './PrintCommand';
import AddSubpageCommand from './subpages/AddSubpageCommand';
import JumpOverSubpageCommand from './subpages/JumpOverSubpageCommand';
import TableBackgroundColorCommand from './TableBackgroundColorCommand';
import TableInsertCommand from './TableInsertCommand';
import TableMergeCellsCommand from './TableMergeCellsCommand';
import TextAlignCommand from './TextAlignCommand';
import TextColorCommand from './TextColorCommand';
import TextHighlightCommand from './TextHighlightCommand';
import { TextInsertTabSpaceCommand, TextRemoveTabSpaceCommand } from './TextInsertTabSpaceCommand';
import ToggleItemLiftCommand, { IndentToggleItem } from './toggleList/keymap';

const { deleteColumn, deleteTable, goToNextCell, splitCell } = ProsemirrorTables;
const { MARK_STRONG, MARK_EM, MARK_STRIKE, MARK_SUPER, MARK_UNDERLINE } = MarkNames;

export const BLOCKQUOTE_INSERT_NEW_LINE = new BlockquoteInsertNewLineCommand();
export const CLEAR_FORMAT = new MarksClearCommand();
export const CODE = new CodeBlockCommand();
export const EM = new MarkToggleCommand(MARK_EM);
export const H1 = new HeadingCommand(1);
export const H2 = new HeadingCommand(2);
export const H3 = new HeadingCommand(3);
export const H4 = new HeadingCommand(4);
export const H5 = new HeadingCommand(5);
export const H6 = new HeadingCommand(6);
export const PARAGRAPH_COMMAND = new HeadingCommand(null);
export const HR = new HorizontalRuleCommand();
export const INDENT_LESS = new IndentCommand(-1);
export const INDENT_MORE = new IndentCommand(1);
export const LINK_SET_URL = new LinkSetURLCommand();
export const LIST_ITEM_INSERT_NEW_LINE = new ListItemInsertNewLineCommand();
export const LIST_ITEM_MERGE_DOWN = new ListItemMergeCommand('down');
export const LIST_ITEM_MERGE_UP = new ListItemMergeCommand('up');
export const LIST_SPLIT = new ListSplitCommand();
export const OL = new ListToggleCommand(ORDERED_LIST);
export const PRINT = new PrintCommand();
export const SUB_PAGE = new AddSubpageCommand();
export const STRIKE = new MarkToggleCommand(MARK_STRIKE);
export const STRONG = new MarkToggleCommand(MARK_STRONG);
export const SUPER = new MarkToggleCommand(MARK_SUPER);
export const TABLE_BACKGROUND_COLOR = new TableBackgroundColorCommand();
export const TABLE_DELETE_COLUMN = createCommand(deleteColumn);
export const TABLE_DELETE_TABLE = createCommand(deleteTable);
export const TABLE_INSERT_TABLE = new TableInsertCommand();
export const IMAGE_INSERT = new ImageInsertCommand();
export const TABLE_MERGE_CELLS = new TableMergeCellsCommand();
export const TABLE_MOVE_TO_NEXT_CELL = createCommand(goToNextCell(1));
export const TABLE_MOVE_TO_PREV_CELL = createCommand(goToNextCell(-1));
export const TABLE_SPLIT_ROW = createCommand(splitCell);
export const TEXT_ALIGN_CENTER = new TextAlignCommand('center');
export const TEXT_ALIGN_JUSTIFY = new TextAlignCommand('justify');
export const TEXT_ALIGN_LEFT = new TextAlignCommand('left');
export const TEXT_ALIGN_RIGHT = new TextAlignCommand('right');
export const TEXT_COLOR = new TextColorCommand();
export const TEXT_HIGHLIGHT = new TextHighlightCommand();
export const TEXT_INSERT_TAB_SPACE = new TextInsertTabSpaceCommand();
export const TEXT_REMOVE_TAB_SPACE = new TextRemoveTabSpaceCommand();
export const UL = new ListToggleCommand(BULLET_LIST);
export const TO_DO = new ListToggleCommand(TODO_LIST);
export const TOGGLE_LIST_INSERT = new ListToggleCommand(TOGGLE_LIST);
export const UNDERLINE = new MarkToggleCommand(MARK_UNDERLINE);
export const COMMENT = new AddCommentCommand();
export const MATH_INSERT = new MathInsertCommand();
export const EM_DASH = new EmDash();
export const EN_DASH = new EnDash();
export const LIFT_DOWN_TOGGLE_ITEM = new ToggleItemLiftCommand('down');
export const INDENT_TOGGLE_ITEM_MORE = new IndentToggleItem('right');
export const INDENT_TOGGLE_ITEM_LESS = new IndentToggleItem('left');
export const JUMP_OVER_SUBPAGE_UP = new JumpOverSubpageCommand('up');
export const JUMP_OVER_SUBPAGE_DOWN = new JumpOverSubpageCommand('down');
